/**
 * 与登陆相关的API接口定义
 */
import axios from './config'
import { AxiosPromise } from 'axios'
import {IuserInfo} from './config/responseType'

/**
 * 获取验证码
 */
export const reqCaptchas = ():AxiosPromise<{status: number,code: string}> =>{
    return axios.request({
        url:'/v1/captchas',
        data:{},
        method:'POST',
    })
}

/**
 *  登陆传入参数的类型
 */
interface accountLoginArgInterface {
    username: string,
    password: string,
    captcha_code: string
}
/**
 * 登陆
 */
export const accountLogin = (data:accountLoginArgInterface):AxiosPromise<IuserInfo> =>{
    return axios.request({
        url:'/v2/login',
        data:data,
        method:'POST',
    })
}
